<?xml version="1.0" encoding="UTF-8"?>
<!-- 
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.org/ui"
      xmlns:t="http://myfaces.apache.org/tomahawk" 
      xmlns:ui="http://java.sun.com/jsf/facelets">
    <ui:decorate template="/tema/padrao.xhtml">
        <ui:define name="centro">
            <h:form id="form">
                <p:fieldset legend="CONSULTA">
                    <h:panelGrid columns="3">
                        <p:commandButton value="NOVO" 
                                         action="#{osBean.novo}" ajax="false" />
                        <p:commandButton value="CONSULTAR"
                                         actionListener="#{osBean.consultar}"
                                         update="tabela" />
                    </h:panelGrid>
                </p:fieldset>
                <br />
                <p:dataTable id="tabela" 
                             value="#{osBean.ordensServico}"
                             var="item" paginator="true"
                             emptyMessage="Nenhum registro encontrado.">
                    <f:facet name="header">
                        Ordens de Serviço
                    </f:facet>
                    <p:column headerText="STATUS">
                        <h:outputText />
                    </p:column>
                    <p:column headerText="Cliente">
                        <h:outputText value="#{item.cliente.nome}"/>
                    </p:column>
                    <p:column headerText="Data">
                        <h:outputText />
                    </p:column>
                    <p:column headerText="VALOR">
                        <h:outputText value="#{item.valor}"/>
                    </p:column>
                    <p:column headerText="EDITAR">
                        <p:commandButton value="EDITAR" action="#{osBean.editar}" ajax="false">
                            <f:setPropertyActionListener value="#{item}" target="#{osBean.os}" />
                        </p:commandButton>
                    </p:column>
                </p:dataTable>
            </h:form>            
        </ui:define>
    </ui:decorate>
</html>